<template>
    <div>
        <a-table :columns="columns" :data-source="newList" :row-key="(record: any) => record.menu_id">
            <!-- <template #expandedRowRender="{ record }">
                <p style="margin: 0">
                    {{ record.name }}
                </p>
            </template> -->
            <template #bodyCell="{ column, record }">
                <div v-if="column.key === 'contral'">
                    <a-button type="primary" @click="edit_table(record)">编辑</a-button>
                </div>
            </template>
        </a-table>
    </div>
</template>

<script setup lang="ts">
import { onMounted ,ref} from "vue";
import { corsApi } from "../../request/http";


const newList = ref<any>([])
    const columns = [
    {
        title: '名称',
        dataIndex: 'title',
        key: 'name',
    },
    {
        title: '标签',
        dataIndex: 'tags',
        key: 'tags',
    },
    {
        title: '内容',
        dataIndex: 'content',
        key: 'content',
    },
  

];
onMounted(async () => {
    await get_list()
})

const get_list = async () => {
    const res = await corsApi('news_lists', 'get', {})
    console.log(res);
    if (res.data.status === 1) {
        newList.value = res.data.result.list
    }
}

</script>

<style scoped></style>